package com.yanqu.road.server.cmd.activity.witchdraw;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.WitchDrawProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.activity.witchdraw.CrossWitchDrawMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

@Cmd(code = CrossProtocol.C_CROSS_WITCH_DRAW_GET_ALL_NOTICE, desc = "跨服获取魔女之夜抽奖公告")
public class CrossWitchDrawGetNoticeListCmd extends CrossCommand {

    private int activityId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        WitchDrawProto.GetNoticeDataFromCrossReq reqMsg = WitchDrawProto.GetNoticeDataFromCrossReq.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        WitchDrawProto.WitchDrawGetNoticeDataResp.Builder activityNoticeMsg = CrossWitchDrawMgr.getActivityNoticeMsg(activityId);
        YanQuMessage pbMsg = YanQuMessageUtils.buildMessage(ClientProtocol.U_WITCH_DRAW_GET_NOTICE,activityNoticeMsg);
        MessageHelper.sendPacket(serverId,packet.getPlayerId(),pbMsg);
    }

    @Override
    public void sendData() {

    }
}
